package com.jstnvr.smartcampus.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private Environment env;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
       // registry.addResourceHandler("/faceImage/**").addResourceLocations("file:D:/shoolCampus/");
        /*如果是获得windows的路径这里要添加file*/
        registry.addResourceHandler("/faceImage/**").addResourceLocations("file:"+env.getProperty("images.save-path"));

    }

}
